import {Injectable} from '@angular/core';
import {environment} from '../../../environments/environment';

@Injectable({
  providedIn: 'root'
})
export class ButtonAuthorityService {


  constructor() {
  }

  /**
   * 验证权限
   */
  public verifyButtonAuthority(value): boolean {
    if (value) {
      const json = localStorage.getItem(environment.authorityKey);
      if (json) {
        const array = JSON.parse(json);
        for (const arr of array) {
          if (arr === value) {
            return true;
          }
        }
      }
      return false;
    }
    return true;
  }
}
